<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@include file="/WEB-INF/mytag.jspf"%>

<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<title>用户</title>
<script type="text/javascript">
$.ajax({
	url: "management/role/listRole",
	type:"POST",
	success:function(data){
		$(data).each(function(n){
            $("<option/>").html(this.name).val(this.roleId)
            .appendTo("#roleId");
        });
		$("#roleId").val('${t.roleId}');
	}
});

$(function() {
	$("form").validate({
		rules : {
			"account" : {
				required : true,
				remote : { // 异步验证是否存在
					type : "POST",
					url : 'management/employee/isExist',
					data : {
						account : function() {
							return $("#account").val();
						},
						id : function() {
							return $("#id").val();
						}
					}
				}
			},
			"target" : {
				number : true,
				isPositiveInteger : true
			}
		},
		messages : {
			"account" : {
				required : "请输入账号",
				remote : "该账号已经存在"
			},
			"target" : {
				number : "请输入合法的数字",
				isPositiveInteger : "请输入大于0的整数"
			}
		}
	});
	$("#submitBtn").on("click",function(){
		$("#form").submit();
	});
});
var layerPage;//弹出框关闭时用到
function showShopTree() {
	layerPage = layer.open({
		title : "选择门店",
		type : 2,
		content : 'management/shop/shopTree'
	});
}
function showTreeData(treeNode){
	$("#shopName").val(treeNode.name);
	$("#shopId").val(treeNode.id);
}
</script>
</head>
<body>
	<ol class="am-breadcrumb am-breadcrumb-slash am-padding" style="margin-bottom: 0px;">
		<li><a href="management/index">首页</a></li>
		<li><a href="management/employee/targetindex">员工月业绩目标设置</a></li>
		<li class="am-active">修改</li>
	</ol>
	<div class="am-g">
		<div class="am-u-md-12">
				<div class="am-tabs am-margin">
					<ul class="am-tabs-nav am-nav am-nav-tabs">
						<li class="am-active"><a href="javascript:void(0)">基本信息</a></li>
					</ul>
					<div class="am-tabs-bd">
						<div class="am-tab-panel am-active">
							<div class="am-g">
								<div class="am-u-md-12">
									<form class="am-form am-form-horizontal" id="form" name="form"  method="post" action="management/employee/targetupdate">
									<input id="id" name="employeeId" type="hidden" value="${t.employeeId }">
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">账号</label>
										<div class="am-u-md-4 am-u-end">
											<input type="text" id="account" name="account" value="${t.account}" class="am-form-field am-input-sm" readonly>
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">角色</label>
										<div class="am-u-md-4 am-u-end">
											<select id="roleId" name="roleId" readonly>
												<option value="">请选择角色</option>
											</select>
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">所属门店</label>
										<div class="am-u-md-4 am-u-end">
											<input type="text" id="shopName" name="shopName" value="${t.shopName}" class="am-form-field am-input-sm" readonly>
											<input type="hidden" id="shopId" name="shopId" value="${t.shopId}" class="am-form-field am-input-sm">
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">姓名</label>
										<div class="am-u-md-4 am-u-end">
											<input type="text" id="name" name="name" value="${t.name}" class="am-form-field am-input-sm" readonly>
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">联系电话</label>
										<div class="am-u-md-4 am-u-end">
											<input type="text" id="phone" name="phone" value="${t.phone}" class="am-form-field am-input-sm" readonly>
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">性别</label>
										<div class="am-u-sm-4 am-u-end am-form-label am-text-left">
											<input type="radio" name="sex" <c:if test="${t.sex eq 'M'}"> checked="checked" </c:if> value="M" disabled="disabled"> 男
											<input type="radio" name="sex" <c:if test="${t.sex eq 'F'}"> checked="checked" </c:if> value="F"  disabled="disabled"> 女
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">月业绩目标(元)</label>
										<div class="am-u-md-4 am-u-end">
											<input type="text" id="target" name="target" value="${t.target}" maxlength="11" class="am-form-field am-input-sm">
										</div>
									</div>
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="am-margin">
					<button class="am-btn am-btn-primary am-btn-xs" type="button" id="submitBtn"><span class="am-icon-check"></span> 保存</button>
					<a href="javascript:;" onClick="javascript:history.back(-1);" class="am-btn am-btn-primary am-btn-xs"><span class="am-icon-times"></span> 取消</a>
				</div>
		</div>
	</div>
</body>
</html>
